<?php

namespace Common\Model;

use Think\Model;

class ChangeSysModel extends Model {
    public static function newSelf()
    {
        return new self();
    }
    public function findOneById($id)
    {
        return $this->where(['id'=>$id])->find();
    }
    
	public function getInfo()
	{
	    $info=$this->where()->select();
	    foreach ($info as $k=>$v)
	    {
	        $infos[$v['id']]=$v;
	    }
	    return $infos;
	}
	public function getNeedCurrencys()
	{

	    $info=$this->getInfo();
	    $infos=[];
	    foreach ($info as $k=>$v)
	    {
	        if (!in_array($v['currency_id'],$infos)) {
	            $infos[]=$v['currency_id'];
	        }
	        if (!in_array($v['to_currency_id'],$infos)) {
	            $infos[]=$v['to_currency_id'];
	        }
	    }
	    return $infos;
	}
}